<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>隐藏</title>
		<style>
			#myid{
				width: 100px;
				height: 200px;
				background: #000;
				display: none;
			}
		</style>
		<script>
			function show () {
				window.onload=show; //加载完之后调用show方法
				var a = document.getElementById('myid');
				if(a.style.display == 'block'){
					a.style.display = 'none';
				}else{
					a.style.display = 'block';
				}
			}
		</script>
	</head>
	<body>
		<input type="button" value="显示隐藏" onclick="show()" />
		<div id="myid"></div>
	</body>
</html>
